package com.topstack.arouterstudy.Demo2

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.topstack.arouterstudy.databinding.ActivityDemo2Binding

@Route(path = "/activity/demo2")
class Demo2 : AppCompatActivity() {

    @Autowired(name = "text")
    @JvmField
    var inputText: String? = null

    @Autowired(name = "book")
    @JvmField
    var book: Book? = null

    private lateinit var binding: ActivityDemo2Binding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        ARouter.getInstance().inject(this)
        binding = ActivityDemo2Binding.inflate(layoutInflater)
        setContentView(binding.root)
        inputText?.let {
            binding.inputText.text = "您输入了：$it+${book?.name}"
        }
    }
}